package com.zx._09_架构.重构;

/**
 * @program: knowledge
 * @description:
 * @author: xue.zhang
 * @create: 2021-11-17 10:19
 */
public class 去掉一次性的临时变量 {

    class BadExample {

        private int i;

        public int someMethod() {
            int temp = getVariable();
            return temp * 100;
        }

        public int getVariable() {
            return i;
        }
    }

    /* ---------------------分割线---------------------- */
    class GoodExample {

        private int i;

        public int someMethod() {
            return getVariable() * 100;
        }

        public int getVariable() {
            return i;
        }
    }
}
